namespace Delphi.Mimir.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddRawStatements : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "raw.eod_balance_sheets",
                c => new
                    {
                        sbs_id = c.Int(nullable: false, identity: true),
                        sbs_sym_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        sbs_exc_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        sbs_dt = c.DateTime(nullable: false),
                        sbs_period = c.String(nullable: false, maxLength: 25, unicode: false),
                        sbs_ca_cash_and_eqv = c.Long(),
                        sbs_ca_st_inv = c.Long(),
                        sbs_ca_net_recbls = c.Long(),
                        sbs_ca_invtry = c.Long(),
                        sbs_ca_other_assts = c.Long(),
                        sbs_ca_tot = c.Long(),
                        sbs_nca_lt_inv = c.Long(),
                        sbs_nca_ppe = c.Long(),
                        sbs_nca_goodwill = c.Long(),
                        sbs_nca_intgbl_assts = c.Long(),
                        sbs_nca_accum_amort = c.Long(),
                        sbs_nca_other_assts = c.Long(),
                        sbs_nca_dfrd_lt_assts_chrg = c.Long(),
                        sbs_tot_assts = c.Long(),
                        sbs_cl_acct_paybl = c.Long(),
                        sbs_cl_crnt_lt_debt = c.Long(),
                        sbs_cl_other = c.Long(),
                        sbs_cl_total = c.Long(),
                        sbs_ncl_lt_debt = c.Long(),
                        sbs_ncl_other_liab = c.Long(),
                        sbs_ncl_dfrd_lt_liab_chrg = c.Long(),
                        sbs_ncl_min_intr = c.Long(),
                        sbs_ncl_neg_goodwill = c.Long(),
                        sbs_tot_liab = c.Long(),
                        sbs_eq_misc_st_opt_wrnt = c.Long(),
                        sbs_eq_redmbl_prfrd_st = c.Long(),
                        sbs_eq_prfrd_st = c.Long(),
                        sbs_eq_comn_st = c.Long(),
                        sbs_eq_rtnd_earn = c.Long(),
                        sbs_eq_trsry_st = c.Long(),
                        sbs_eq_cap_spls = c.Long(),
                        sbs_eq_other_eqty = c.Long(),
                        sbs_total_eqty = c.Long(),
                        sbs_net_tgbl_assts = c.Long(),
                    })
                .PrimaryKey(t => t.sbs_id);
            
            CreateTable(
                "raw.eod_cash_flows",
                c => new
                    {
                        scf_id = c.Int(nullable: false, identity: true),
                        scf_sym_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        scf_exc_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        scf_period = c.String(nullable: false, maxLength: 25, unicode: false),
                        scf_dt = c.DateTime(nullable: false),
                        scf_depr = c.Long(),
                        scf_adj_ni = c.Long(),
                        scf_chng_acct_recbls = c.Long(),
                        scf_chng_liab = c.Long(),
                        scf_chng_invtry = c.Long(),
                        scf_chng_other_ops = c.Long(),
                        scf_tot_cfo = c.Long(),
                        scf_capex = c.Long(),
                        scf_inv = c.Long(),
                        scf_other_inv = c.Long(),
                        scf_tot_cfi = c.Long(),
                        scf_div_paid = c.Long(),
                        scf_sal_purch_st = c.Long(),
                        scf_net_borrow = c.Long(),
                        scf_other_fin = c.Long(),
                        scf_tot_cff = c.Long(),
                        scf_fx_rate_chng = c.Long(),
                        scf_chng_cash_and_eqv = c.Long(),
                    })
                .PrimaryKey(t => t.scf_id);
            
            CreateTable(
                "raw.eod_income_statements",
                c => new
                    {
                        sis_id = c.Int(nullable: false, identity: true),
                        sis_period = c.String(nullable: false, maxLength: 25, unicode: false),
                        sis_sym_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        sis_exc_cd = c.String(nullable: false, maxLength: 25, unicode: false),
                        sis_dt = c.DateTime(nullable: false),
                        sis_tot_revenue = c.Long(),
                        sis_cogs = c.Long(),
                        sis_gross_profit = c.Long(),
                        sis_rnd = c.Long(),
                        sis_sga = c.Long(),
                        sis_non_rec_exp = c.Long(),
                        sis_other_exp = c.Long(),
                        sis_tot_opex = c.Long(),
                        sis_op_income = c.Long(),
                        sis_tot_other_income = c.Long(),
                        sis_ebit = c.Long(),
                        sis_interest_expense = c.Long(),
                        sis_ebt = c.Long(),
                        sis_income_tax_expense = c.Long(),
                        sis_minority_interest = c.Long(),
                        sis_ni_continuing_ops = c.Long(),
                        sis_discnt_ops = c.Long(),
                        sis_extraordinary_items = c.Long(),
                        sis_accounting_changes = c.Long(),
                        sis_other_items = c.Long(),
                        sis_ni = c.Long(),
                        sis_prfrd_stock_adjust = c.Long(),
                        sis_ni_common = c.Long(),
                    })
                .PrimaryKey(t => t.sis_id);
            
        }
        
        public override void Down()
        {
            DropTable("raw.eod_income_statements");
            DropTable("raw.eod_cash_flows");
            DropTable("raw.eod_balance_sheets");
        }
    }
}
